<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<script src="http://cdn.bootcss.com/jquery/2.2.3/jquery.js"></script>
</head>
<body>
<h2 id="time"></h2>
<button>点我</button>

<script type="text/javascript">
$('button').click(getTime);
function getTime() {
	$.post('getTime',function(data) {
		$('#time').text(data)
		//hash(data)
		var url = location.href.substring(0,location.href.lastIndexOf('/')+1)+data
		//console.info(url)
		history.pushState({},'',url)
	})
}
window.addEventListener("popstate", function() {
    var currentState = history.state;
    console.info(history)
    $('#time').text(location.href.substring(location.href.lastIndexOf('/')+1))
    
});
function hash(h) {
	console.info(window.location.href.split('#')[0]+'#'+h)
	window.location.href = window.location.href.split('#')[0]+'#'+h
}

</script>
</body>
</html>
